package entity;

import java.util.Date;


public class User {
	private Integer id; //id 
	//@NotEmpty(message="用户编码不能为空!")
	private String userCode; //鐢ㄦ埛缂栫爜
	//@NotNull(message="用户名不能为空!")
	private String userName; //鐢ㄦ埛鍚嶇О
	private String userPassword; //鐢ㄦ埛瀵嗙爜
	private Integer gender;  //鎬у埆
	//使用@ModelA.....注解 日期类型需要配置一个日期转换注解
	//@DateTimeFormat(pattern="yyyy-MM-dd")
	//@JSONField(format="yyyy-MM-dd")
	private Date birthday;  //鍑虹敓鏃ユ湡
	private String phone;   //鐢佃瘽
	private String address; //鍦板潃
	private Integer userRole;    //鐢ㄦ埛瑙掕壊
	private Integer createdBy;   //鍒涘缓鑰�
	//@JSONField(format="yyyy-MM-dd")
	private Date creationDate; //鍒涘缓鏃堕棿
	private Integer modifyBy;     //鏇存柊鑰�
	private Date modifyDate;   //鏇存柊鏃堕棿
	
	private Integer age;//骞撮緞
	
	private String userRoleName;    //鐢ㄦ埛瑙掕壊鍚嶇О
	private String cardPath;
	

	
	public String getCardPath() {
		return cardPath;
	}
	public void setCardPath(String cardPath) {
		this.cardPath = cardPath;
	}
	public void setAge(Integer age) {
		this.age = age;
	}
	public String getUserRoleName() {
		return userRoleName;
	}
	public void setUserRoleName(String userRoleName) {
		this.userRoleName = userRoleName;
	}
	public Integer getAge() {
		/*long time = System.currentTimeMillis()-birthday.getTime();
		Integer age = Long.valueOf(time/365/24/60/60/1000).IntegerValue();*/
		Date date = new Date();
		Integer age = date.getYear()-birthday.getYear();
		return age;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUserCode() {
		return userCode;
	}
	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPassword() {
		return userPassword;
	}
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	public Integer getGender() {
		return gender;
	}
	public void setGender(Integer gender) {
		this.gender = gender;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Integer getUserRole() {
		return userRole;
	}
	public void setUserRole(Integer userRole) {
		this.userRole = userRole;
	}
	public Integer getCreatedBy() {
		return createdBy;
	}
	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}
	public Date getCreationDate() {
		return creationDate;
	}
	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}
	public Integer getModifyBy() {
		return modifyBy;
	}
	public void setModifyBy(Integer modifyBy) {
		this.modifyBy = modifyBy;
	}
	public Date getModifyDate() {
		return modifyDate;
	}
	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}
	@Override
	public String toString() {
		return "User [id=" + id + ", userCode=" + userCode + ", userName=" + userName + ", userPassword=" + userPassword
				+ ", gender=" + gender + ", birthday=" + birthday + ", phone=" + phone + ", address=" + address
				+ ", userRole=" + userRole + ", createdBy=" + createdBy + ", creationDate=" + creationDate
				+ ", modifyBy=" + modifyBy + ", modifyDate=" + modifyDate + ", age=" + age + ", userRoleName="
				+ userRoleName + ", cardPath=" + cardPath + "]";
	}

	
	/*前端验证:非空,格式等
	 * 
	 * 
	 * 后端校验: 导入jar包,  在实体类字段加入相关注解,在表单提交的controllere 方法参数前价@vilad注解,在后面加入BindingResult br,在前端验证不通过的内容
	 * 
	 * 
	 * 
	 * 
	*/
	
	
	
	
	
	
}
